package com.dq.service.record.impl;

import com.dq.domain.record.ArrearsRecord;
import com.dq.domain.sys.user.user.base.SysUser;
import com.dq.repository.record.ArrearsRecordRepository;
import com.dq.service.record.ArrearsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author luchangtong
 * @Date 2019/12/5 9:18
 */
@Service
public class ArrearsServiceImpl implements ArrearsService {
    @Autowired
    private ArrearsRecordRepository arrearsRecordRepository;
    /**
     * 退款记录
     * true 有欠款
     * false 无
     * @param sysUser
     * @return
     */
    @Override
    public boolean findByUser(SysUser sysUser) {
        List<ArrearsRecord> list = arrearsRecordRepository.findBySysUserAndArrearsStatusAndDeletedFalse(sysUser, ArrearsRecord.ArrearsStatus.notPay);
        if(list.size() > 0){
            return true;
        }
        return false;
    }
}
